<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Net::POP3 - net-pop: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#class-Net::POP3-label-What+is+This+Library-3F">What is This Library?</a>
    <li><a href="#class-Net::POP3-label-Examples">Examples</a>
    <li><a href="#class-Net::POP3-label-Retrieving+Messages">Retrieving Messages</a>
    <li><a href="#class-Net::POP3-label-Shortened+Code">Shortened Code</a>
    <li><a href="#class-Net::POP3-label-Memory+Space+Issues">Memory Space Issues</a>
    <li><a href="#class-Net::POP3-label-Using+APOP">Using APOP</a>
    <li><a href="#class-Net::POP3-label-Fetch+Only+Selected+Mail+Using+-27UIDL-27+POP+Command">Fetch Only Selected Mail Using ‘UIDL’ POP Command</a>
  </ul>
</div>


    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Protocol
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-APOP">::APOP</a>
    <li ><a href="#method-c-auth_only">::auth_only</a>
    <li ><a href="#method-c-certs">::certs</a>
    <li ><a href="#method-c-create_ssl_params">::create_ssl_params</a>
    <li ><a href="#method-c-default_pop3_port">::default_pop3_port</a>
    <li ><a href="#method-c-default_pop3s_port">::default_pop3s_port</a>
    <li ><a href="#method-c-default_port">::default_port</a>
    <li ><a href="#method-c-delete_all">::delete_all</a>
    <li ><a href="#method-c-disable_ssl">::disable_ssl</a>
    <li ><a href="#method-c-enable_ssl">::enable_ssl</a>
    <li ><a href="#method-c-foreach">::foreach</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-ssl_params">::ssl_params</a>
    <li ><a href="#method-c-start">::start</a>
    <li ><a href="#method-c-use_ssl-3F">::use_ssl?</a>
    <li ><a href="#method-c-verify">::verify</a>
    <li ><a href="#method-i-active-3F">#active?</a>
    <li ><a href="#method-i-apop-3F">#apop?</a>
    <li ><a href="#method-i-auth_only">#auth_only</a>
    <li ><a href="#method-i-delete_all">#delete_all</a>
    <li ><a href="#method-i-disable_ssl">#disable_ssl</a>
    <li ><a href="#method-i-each">#each</a>
    <li ><a href="#method-i-each_mail">#each_mail</a>
    <li ><a href="#method-i-enable_ssl">#enable_ssl</a>
    <li ><a href="#method-i-finish">#finish</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-logging">#logging</a>
    <li ><a href="#method-i-mails">#mails</a>
    <li ><a href="#method-i-n_bytes">#n_bytes</a>
    <li ><a href="#method-i-n_mails">#n_mails</a>
    <li ><a href="#method-i-port">#port</a>
    <li ><a href="#method-i-read_timeout-3D">#read_timeout=</a>
    <li ><a href="#method-i-reset">#reset</a>
    <li ><a href="#method-i-set_debug_output">#set_debug_output</a>
    <li ><a href="#method-i-start">#start</a>
    <li ><a href="#method-i-started-3F">#started?</a>
    <li ><a href="#method-i-use_ssl-3F">#use_ssl?</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Net::POP3">
    <h1 id="class-Net::POP3" class="class">
      class Net::POP3
    </h1>

    <section class="description">
    
<h2 id="class-Net::POP3-label-What+is+This+Library-3F">What is This Library?<span><a href="#class-Net::POP3-label-What+is+This+Library-3F">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>This library provides functionality for retrieving email via <a href="POP3.html"><code>POP3</code></a>, the Post Office Protocol version 3. For details of <a href="POP3.html"><code>POP3</code></a>, see [RFC1939] (<a href="http://www.ietf.org/rfc/rfc1939.txt">www.ietf.org/rfc/rfc1939.txt</a>).</p>

<h2 id="class-Net::POP3-label-Examples">Examples<span><a href="#class-Net::POP3-label-Examples">&para;</a> <a href="#top">&uarr;</a></span></h2>

<h3 id="class-Net::POP3-label-Retrieving+Messages">Retrieving Messages<span><a href="#class-Net::POP3-label-Retrieving+Messages">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>This example retrieves messages from the server and deletes them on the server.</p>

<p>Messages are written to files named ‘inbox/1’, ‘inbox/2’, .… Replace ‘pop.example.com’ with your <a href="POP3.html"><code>POP3</code></a> server address, and ‘YourAccount’ and ‘YourPassword’ with the appropriate account details.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/pop&#39;</span>

<span class="ruby-identifier">pop</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>)
<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>)             <span class="ruby-comment"># (1)</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">mails</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;No mail.&#39;</span>
<span class="ruby-keyword">else</span>
  <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">each_mail</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>   <span class="ruby-comment"># or &quot;pop.mails.each ...&quot;   # (2)</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">&quot;inbox/#{i}&quot;</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">m</span>.<span class="ruby-identifier">delete</span>
    <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{pop.mails.size} mails popped.&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">finish</span>                                           <span class="ruby-comment"># (3)</span>
</pre>
<ol><li>
<p>Call <a href="POP3.html#method-i-start"><code>Net::POP3#start</code></a> and start POP session.</p>
</li><li>
<p>Access messages by using <a href="POP3.html#method-i-each_mail"><code>POP3#each_mail</code></a> and/or <a href="POP3.html#method-i-mails"><code>POP3#mails</code></a>.</p>
</li><li>
<p>Close POP session by calling <a href="POP3.html#method-i-finish"><code>POP3#finish</code></a> or use the block form of <a href="POP3.html#method-i-start"><code>start</code></a>.</p>
</li></ol>

<h3 id="class-Net::POP3-label-Shortened+Code">Shortened Code<span><a href="#class-Net::POP3-label-Shortened+Code">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>The example above is very verbose. You can shorten the code by using some utility methods. First, the block form of <a href="POP3.html#method-c-start"><code>Net::POP3.start</code></a> can be used instead of <a href="POP3.html#method-c-new"><code>POP3.new</code></a>, <a href="POP3.html#method-i-start"><code>POP3#start</code></a> and <a href="POP3.html#method-i-finish"><code>POP3#finish</code></a>.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/pop&#39;</span>

<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">mails</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;No mail.&#39;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
    <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">each_mail</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>   <span class="ruby-comment"># or &quot;pop.mails.each ...&quot;</span>
      <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">&quot;inbox/#{i}&quot;</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">m</span>.<span class="ruby-identifier">delete</span>
      <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{pop.mails.size} mails popped.&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p><a href="POP3.html#method-i-delete_all"><code>POP3#delete_all</code></a> is an alternative for <a href="POP3.html#method-i-each_mail"><code>each_mail</code></a> and delete.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/pop&#39;</span>

<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">mails</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;No mail.&#39;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
    <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">delete_all</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
      <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">&quot;inbox/#{i}&quot;</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>And here is an even shorter example.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/pop&#39;</span>

<span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">delete_all</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                     <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">&quot;inbox/#{i}&quot;</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
<span class="ruby-keyword">end</span>
</pre>

<h3 id="class-Net::POP3-label-Memory+Space+Issues">Memory Space Issues<span><a href="#class-Net::POP3-label-Memory+Space+Issues">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>All the examples above get each message as one big string. This example avoids this.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/pop&#39;</span>

<span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">delete_all</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                     <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">&quot;inbox/#{i}&quot;</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">chunk</span><span class="ruby-operator">|</span>    <span class="ruby-comment"># get a message little by little.</span>
      <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">chunk</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<h3 id="class-Net::POP3-label-Using+APOP">Using <a href="APOP.html"><code>APOP</code></a><span><a href="#class-Net::POP3-label-Using+APOP">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>The net/pop library supports <a href="APOP.html"><code>APOP</code></a> authentication. To use <a href="APOP.html"><code>APOP</code></a>, use the <a href="APOP.html"><code>Net::APOP</code></a> class instead of the <a href="POP3.html"><code>Net::POP3</code></a> class. You can use the utility method, <a href="POP3.html#method-c-APOP"><code>Net::POP3.APOP()</code></a>. For example:</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;net/pop&#39;</span>

<span class="ruby-comment"># Use APOP authentication if $isapop == true</span>
<span class="ruby-identifier">pop</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-constant">APOP</span>(<span class="ruby-identifier">$isapop</span>).<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;apop.example.com&#39;</span>, <span class="ruby-value">110</span>)
<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
  <span class="ruby-comment"># Rest of the code is the same.</span>
<span class="ruby-keyword">end</span>
</pre>

<h3 id="class-Net::POP3-label-Fetch+Only+Selected+Mail+Using+-27UIDL-27+POP+Command">Fetch Only Selected Mail Using ‘UIDL’ POP Command<span><a href="#class-Net::POP3-label-Fetch+Only+Selected+Mail+Using+-27UIDL-27+POP+Command">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>If your POP server provides UIDL functionality, you can grab only selected mails from the POP server. e.g.</p>

<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">need_pop?</span>( <span class="ruby-identifier">id</span> )
  <span class="ruby-comment"># determine if we need pop this mail...</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">start</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                <span class="ruby-string">&#39;Your account&#39;</span>, <span class="ruby-string">&#39;Your password&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">mails</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">need_pop?</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">unique_id</span>) }.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">do_something</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>The <a href="POPMail.html#method-i-unique_id"><code>POPMail#unique_id()</code></a> method returns the unique-id of the message as a String. Normally the unique-id is a hash of the message.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="VERSION">VERSION
          <dd><p>version of this library</p>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-address" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">address</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The address to connect to.</p>
              </div>
            </div>
          <div id="attribute-i-open_timeout" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">open_timeout</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Seconds to wait until a connection is opened. If the <a href="POP3.html"><code>POP3</code></a> object cannot open a connection within this time, it raises a Net::OpenTimeout exception. The default value is 30 seconds.</p>
              </div>
            </div>
          <div id="attribute-i-read_timeout" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">read_timeout</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Seconds to wait until reading one block (by one read(1) call). If the <a href="POP3.html"><code>POP3</code></a> object cannot complete a read() within this time, it raises a Net::ReadTimeout exception. The default value is 60 seconds.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-APOP" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">APOP</span><span
                                class="method-args">(isapop)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the <a href="APOP.html"><code>APOP</code></a> class if <code>isapop</code> is true; otherwise, returns the POP class.  For example:</p>

<pre># Example 1
pop = Net::POP3::APOP($is_apop).new(addr, port)

# Example 2
Net::POP3::APOP($is_apop).start(addr, port) do |pop|
  ....
end</pre>

                              <div class="method-source-code" id="APOP-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 238</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-constant">APOP</span>(<span class="ruby-identifier ruby-title">isapop</span>)
  <span class="ruby-identifier">isapop</span> <span class="ruby-operator">?</span> <span class="ruby-constant">APOP</span> <span class="ruby-operator">:</span> <span class="ruby-constant">POP3</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-auth_only" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_only</span><span
                                class="method-args">(address, port = nil, account = nil, password = nil, isapop = false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Opens a <a href="POP3.html"><code>POP3</code></a> session, attempts authentication, and quits.</p>

<p>This method raises <a href="POPAuthenticationError.html"><code>POPAuthenticationError</code></a> if authentication fails.</p>

<h3 id="method-c-auth_only-label-Example-3A+normal+POP3">Example: normal <a href="POP3.html"><code>POP3</code></a><span><a href="#method-c-auth_only-label-Example-3A+normal+POP3">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">auth_only</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                    <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>)
</pre>

<h3 id="method-c-auth_only-label-Example-3A+APOP">Example: <a href="APOP.html"><code>APOP</code></a><span><a href="#method-c-auth_only-label-Example-3A+APOP">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">auth_only</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                    <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>, <span class="ruby-keyword">true</span>)
</pre>

                              <div class="method-source-code" id="auth_only-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 305</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">auth_only</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>,
                   <span class="ruby-identifier">account</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">password</span> = <span class="ruby-keyword">nil</span>,
                   <span class="ruby-identifier">isapop</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">new</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">isapop</span>).<span class="ruby-identifier">auth_only</span> <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-certs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">certs</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the :ca_file or :ca_path from <a href="POP3.html#method-c-ssl_params"><code>POP3.ssl_params</code></a></p>

                              <div class="method-source-code" id="certs-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 377</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">certs</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@ssl_params</span>[<span class="ruby-value">:ca_file</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@ssl_params</span>[<span class="ruby-value">:ca_path</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-create_ssl_params" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">create_ssl_params</span><span
                                class="method-args">(verify_or_params = {}, certs = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Constructs proper parameters from arguments</p>

                              <div class="method-source-code" id="create_ssl_params-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 337</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">create_ssl_params</span>(<span class="ruby-identifier">verify_or_params</span> = {}, <span class="ruby-identifier">certs</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">params</span> = <span class="ruby-identifier">verify_or_params</span>.<span class="ruby-identifier">to_hash</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMethodError</span>
    <span class="ruby-identifier">params</span> = {}
    <span class="ruby-identifier">params</span>[<span class="ruby-value">:verify_mode</span>] = <span class="ruby-identifier">verify_or_params</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">certs</span>
      <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">certs</span>)
        <span class="ruby-identifier">params</span>[<span class="ruby-value">:ca_file</span>] = <span class="ruby-identifier">certs</span>
      <span class="ruby-keyword">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">certs</span>)
        <span class="ruby-identifier">params</span>[<span class="ruby-value">:ca_path</span>] = <span class="ruby-identifier">certs</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">params</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_pop3_port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_pop3_port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default port for <a href="POP3.html"><code>POP3</code></a> connections, port 110</p>

                              <div class="method-source-code" id="default_pop3_port-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 210</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">default_pop3_port</span>
  <span class="ruby-value">110</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_pop3s_port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_pop3s_port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default port for POP3S connections, port 995</p>

                              <div class="method-source-code" id="default_pop3s_port-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 215</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">default_pop3s_port</span>
  <span class="ruby-value">995</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the port for <a href="POP3.html"><code>POP3</code></a></p>

                              <div class="method-source-code" id="default_port-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 205</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">default_port</span>
  <span class="ruby-identifier">default_pop3_port</span>()
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-delete_all" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">delete_all</span><span
                                class="method-args">(address, port = nil, account = nil, password = nil, isapop = false, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Starts a <a href="POP3.html"><code>POP3</code></a> session and deletes all messages on the server. If a block is given, each <a href="POPMail.html"><code>POPMail</code></a> object is yielded to it before being deleted.</p>

<p>This method raises a <a href="POPAuthenticationError.html"><code>POPAuthenticationError</code></a> if authentication fails.</p>

<h3 id="method-c-delete_all-label-Example">Example<span><a href="#method-c-delete_all-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">delete_all</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                     <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="delete_all-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 283</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">delete_all</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>,
                    <span class="ruby-identifier">account</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">password</span> = <span class="ruby-keyword">nil</span>,
                    <span class="ruby-identifier">isapop</span> = <span class="ruby-keyword">false</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">start</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">isapop</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">delete_all</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-disable_ssl" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">disable_ssl</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Disable SSL for all new instances.</p>

                              <div class="method-source-code" id="disable_ssl-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 355</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">disable_ssl</span>
  <span class="ruby-ivar">@ssl_params</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-enable_ssl" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Net::POP.enable_ssl(params = {})
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Enable SSL for all new instances. <code>params</code> is passed to OpenSSL::SSLContext#set_params.</p>

                              <div class="method-source-code" id="enable_ssl-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 332</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">enable_ssl</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-ivar">@ssl_params</span> = <span class="ruby-identifier">create_ssl_params</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-foreach" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">foreach</span><span
                                class="method-args">(address, port = nil, account = nil, password = nil, isapop = false) { |message| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Starts a <a href="POP3.html"><code>POP3</code></a> session and iterates over each <a href="POPMail.html"><code>POPMail</code></a> object, yielding it to the <code>block</code>. This method is equivalent to:</p>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">each_mail</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">m</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>This method raises a <a href="POPAuthenticationError.html"><code>POPAuthenticationError</code></a> if authentication fails.</p>

<h3 id="method-c-foreach-label-Example">Example<span><a href="#method-c-foreach-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">foreach</span>(<span class="ruby-string">&#39;pop.example.com&#39;</span>, <span class="ruby-value">110</span>,
                  <span class="ruby-string">&#39;YourAccount&#39;</span>, <span class="ruby-string">&#39;YourPassword&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
  <span class="ruby-identifier">m</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DELETE</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="foreach-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 262</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">foreach</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>,
                 <span class="ruby-identifier">account</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">password</span> = <span class="ruby-keyword">nil</span>,
                 <span class="ruby-identifier">isapop</span> = <span class="ruby-keyword">false</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)  <span class="ruby-comment"># :yields: message</span>
  <span class="ruby-identifier">start</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">isapop</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">each_mail</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(addr, port = nil, isapop = false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="POP3.html"><code>POP3</code></a> object.</p>

<p><code>address</code> is the hostname or ip address of your <a href="POP3.html"><code>POP3</code></a> server.</p>

<p>The optional <code>port</code> is the port to connect to.</p>

<p>The optional <code>isapop</code> specifies whether this connection is going to use <a href="APOP.html"><code>APOP</code></a> authentication; it defaults to <code>false</code>.</p>

<p>This method does <strong>not</strong> open the TCP connection.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 417</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">addr</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">isapop</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-ivar">@address</span> = <span class="ruby-identifier">addr</span>
  <span class="ruby-ivar">@ssl_params</span> = <span class="ruby-constant">POP3</span>.<span class="ruby-identifier">ssl_params</span>
  <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
  <span class="ruby-ivar">@apop</span> = <span class="ruby-identifier">isapop</span>

  <span class="ruby-ivar">@command</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@started</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@open_timeout</span> = <span class="ruby-value">30</span>
  <span class="ruby-ivar">@read_timeout</span> = <span class="ruby-value">60</span>
  <span class="ruby-ivar">@debug_output</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-ivar">@mails</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@n_mails</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@n_bytes</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ssl_params" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ssl_params</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the SSL Parameters</p>

<p>see also <a href="POP3.html#method-c-enable_ssl"><code>POP3.enable_ssl</code></a></p>

                              <div class="method-source-code" id="ssl_params-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 362</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">ssl_params</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@ssl_params</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-start" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">start</span><span
                                class="method-args">(address, port = nil, account = nil, password = nil, isapop = false) { |pop| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="POP3.html"><code>POP3</code></a> object and open the connection.  Equivalent to</p>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">isapop</span>).<span class="ruby-identifier">start</span>(<span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>)
</pre>

<p>If <code>block</code> is provided, yields the newly-opened <a href="POP3.html"><code>POP3</code></a> object to it, and automatically closes it at the end of the session.</p>

<h3 id="method-c-start-label-Example">Example<span><a href="#method-c-start-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">POP3</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">addr</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pop</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">pop</span>.<span class="ruby-identifier">each_mail</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-identifier">m</span>.<span class="ruby-identifier">delete</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="start-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 401</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">start</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>,
               <span class="ruby-identifier">account</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">password</span> = <span class="ruby-keyword">nil</span>,
               <span class="ruby-identifier">isapop</span> = <span class="ruby-keyword">false</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)   <span class="ruby-comment"># :yield: pop</span>
  <span class="ruby-identifier">new</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">isapop</span>).<span class="ruby-identifier">start</span>(<span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-use_ssl-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">use_ssl?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns <code>true</code> if <a href="POP3.html#method-c-ssl_params"><code>POP3.ssl_params</code></a> is set</p>

                              <div class="method-source-code" id="use_ssl-3F-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 367</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">use_ssl?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@ssl_params</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-verify" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">verify</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns whether verify_mode is enable from <a href="POP3.html#method-c-ssl_params"><code>POP3.ssl_params</code></a></p>

                              <div class="method-source-code" id="verify-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 372</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier ruby-title">verify</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@ssl_params</span>[<span class="ruby-value">:verify_mode</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-active-3F" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">active?</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="POP3.html#method-i-started-3F">started?</a>
                            </div>
                          </div>

                  <div id="method-i-apop-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">apop?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Does this instance use <a href="APOP.html"><code>APOP</code></a> authentication?</p>

                              <div class="method-source-code" id="apop-3F-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 436</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">apop?</span>
  <span class="ruby-ivar">@apop</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-auth_only" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">auth_only</span><span
                                class="method-args">(account, password)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Starts a pop3 session, attempts authentication, and quits. This method must not be called while <a href="POP3.html"><code>POP3</code></a> session is opened. This method raises <a href="POPAuthenticationError.html"><code>POPAuthenticationError</code></a> if authentication fails.</p>

                              <div class="method-source-code" id="auth_only-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 314</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">auth_only</span>(<span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;opening previously opened POP session&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">started?</span>
  <span class="ruby-identifier">start</span>(<span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>) {
    ;
  }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-delete_all" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">delete_all</span><span
                                class="method-args">() { |message| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Deletes all messages on the server.</p>

<p>If called with a block, yields each message in turn before deleting it.</p>

<h3 id="method-i-delete_all-label-Example">Example<span><a href="#method-i-delete_all-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre class="ruby"><span class="ruby-identifier">n</span> = <span class="ruby-value">1</span>
<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">delete_all</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">&quot;inbox/#{n}&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pop</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">n</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
<span class="ruby-keyword">end</span>
</pre>

<p>This method raises a <a href="POPError.html"><code>POPError</code></a> if an error occurs.</p>

                              <div class="method-source-code" id="delete_all-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 690</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_all</span> <span class="ruby-comment"># :yield: message</span>
  <span class="ruby-identifier">mails</span>().<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">m</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">m</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">deleted?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-disable_ssl" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">disable_ssl</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Disable SSL for all new instances.</p>

                              <div class="method-source-code" id="disable_ssl-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 463</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">disable_ssl</span>
  <span class="ruby-ivar">@ssl_params</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">each</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="POP3.html#method-i-each_mail">each_mail</a>
                            </div>
                          </div>

                  <div id="method-i-each_mail" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_mail</span><span
                                class="method-args">() { |message| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Yields each message to the passed-in block in turn. Equivalent to:</p>

<pre>pop3.mails.each do |popmail|
  ....
end</pre>

<p>This method raises a <a href="POPError.html"><code>POPError</code></a> if an error occurs.</p>

                              <div class="method-source-code" id="each_mail-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 668</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_mail</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)  <span class="ruby-comment"># :yield: message</span>
  <span class="ruby-identifier">mails</span>().<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="POP3.html#method-i-each">each</a>
                            </div>

                          </div>

                  <div id="method-i-enable_ssl" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Net::POP#enable_ssl(params = {})
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Enables SSL for this instance.  Must be called before the connection is established to have any effect. <code>params[:port]</code> is port to establish the SSL connection on; Defaults to 995. <code>params</code> (except :port) is passed to OpenSSL::SSLContext#set_params.</p>

                              <div class="method-source-code" id="enable_ssl-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 452</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enable_ssl</span>(<span class="ruby-identifier">verify_or_params</span> = {}, <span class="ruby-identifier">certs</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">port</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">begin</span>
    <span class="ruby-ivar">@ssl_params</span> = <span class="ruby-identifier">verify_or_params</span>.<span class="ruby-identifier">to_hash</span>.<span class="ruby-identifier">dup</span>
    <span class="ruby-ivar">@port</span> = <span class="ruby-ivar">@ssl_params</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:port</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@port</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMethodError</span>
    <span class="ruby-ivar">@ssl_params</span> = <span class="ruby-constant">POP3</span>.<span class="ruby-identifier">create_ssl_params</span>(<span class="ruby-identifier">verify_or_params</span>, <span class="ruby-identifier">certs</span>)
    <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@port</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-finish" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">finish</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Finishes a <a href="POP3.html"><code>POP3</code></a> session and closes TCP connection.</p>

                              <div class="method-source-code" id="finish-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 589</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">finish</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;POP session not yet started&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">started?</span>
  <span class="ruby-identifier">do_finish</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">inspect</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Provide human-readable stringification of class state.</p>

                              <div class="method-source-code" id="inspect-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 468</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">inspect</span>
  <span class="ruby-node">+&quot;#&lt;#{self.class} #{@address}:#{@port} open=#{@started}&gt;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-logging" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">logging</span><span
                                class="method-args">(msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>debugging output for <code>msg</code></p>

                              <div class="method-source-code" id="logging-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 715</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">logging</span>(<span class="ruby-identifier">msg</span>)
  <span class="ruby-ivar">@debug_output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">msg</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@debug_output</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mails" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mails</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns an array of <a href="POPMail.html"><code>Net::POPMail</code></a> objects, representing all the messages on the server.  This array is renewed when the session restarts; otherwise, it is fetched from the server the first time this method is called (directly or indirectly) and cached.</p>

<p>This method raises a <a href="POPError.html"><code>POPError</code></a> if an error occurs.</p>

                              <div class="method-source-code" id="mails-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 646</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mails</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@mails</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@mails</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">n_mails</span>() <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
    <span class="ruby-comment"># some popd raises error for LIST on the empty mailbox.</span>
    <span class="ruby-ivar">@mails</span> = []
    <span class="ruby-keyword">return</span> []
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@mails</span> = <span class="ruby-identifier">command</span>().<span class="ruby-identifier">list</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">num</span>, <span class="ruby-identifier">size</span><span class="ruby-operator">|</span>
    <span class="ruby-constant">POPMail</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">size</span>, <span class="ruby-keyword">self</span>, <span class="ruby-identifier">command</span>())
  }
  <span class="ruby-ivar">@mails</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-n_bytes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">n_bytes</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the total size in bytes of all the messages on the POP server.</p>

                              <div class="method-source-code" id="n_bytes-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 634</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">n_bytes</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@n_bytes</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@n_bytes</span>
  <span class="ruby-ivar">@n_mails</span>, <span class="ruby-ivar">@n_bytes</span> = <span class="ruby-identifier">command</span>().<span class="ruby-identifier">stat</span>
  <span class="ruby-ivar">@n_bytes</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-n_mails" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">n_mails</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the number of messages on the POP server.</p>

                              <div class="method-source-code" id="n_mails-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 627</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">n_mails</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@n_mails</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@n_mails</span>
  <span class="ruby-ivar">@n_mails</span>, <span class="ruby-ivar">@n_bytes</span> = <span class="ruby-identifier">command</span>().<span class="ruby-identifier">stat</span>
  <span class="ruby-ivar">@n_mails</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-port" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">port</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The port number to connect to.</p>

                              <div class="method-source-code" id="port-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 493</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">port</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@port</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">use_ssl?</span> <span class="ruby-operator">?</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier">default_pop3s_port</span> <span class="ruby-operator">:</span> <span class="ruby-constant">POP3</span>.<span class="ruby-identifier">default_pop3_port</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-read_timeout-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">read_timeout=</span><span
                                class="method-args">(sec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the read timeout.</p>

                              <div class="method-source-code" id="read_timeout-3D-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 508</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">read_timeout=</span>(<span class="ruby-identifier">sec</span>)
  <span class="ruby-ivar">@command</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">read_timeout</span> = <span class="ruby-identifier">sec</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@command</span>
  <span class="ruby-ivar">@read_timeout</span> = <span class="ruby-identifier">sec</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-reset" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">reset</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Resets the session.  This clears all “deleted” marks from messages.</p>

<p>This method raises a <a href="POPError.html"><code>POPError</code></a> if an error occurs.</p>

                              <div class="method-source-code" id="reset-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 700</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reset</span>
  <span class="ruby-identifier">command</span>().<span class="ruby-identifier">rset</span>
  <span class="ruby-identifier">mails</span>().<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">m</span>.<span class="ruby-identifier">instance_eval</span> {
      <span class="ruby-ivar">@deleted</span> = <span class="ruby-keyword">false</span>
    }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_debug_output" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_debug_output</span><span
                                class="method-args">(arg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><strong>WARNING</strong>: This method causes a serious security hole. Use this method only for debugging.</p>

<p>Set an output stream for debugging.</p>

<h3 id="method-i-set_debug_output-label-Example">Example<span><a href="#method-i-set_debug_output-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>

<pre>pop = Net::POP.new(addr, port)
pop.set_debug_output $stderr
pop.start(account, passwd) do |pop|
  ....
end</pre>

                              <div class="method-source-code" id="set_debug_output-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 485</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_debug_output</span>(<span class="ruby-identifier">arg</span>)
  <span class="ruby-ivar">@debug_output</span> = <span class="ruby-identifier">arg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">start</span><span
                                class="method-args">(account, password) { |pop| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Starts a <a href="POP3.html"><code>POP3</code></a> session.</p>

<p>When called with block, gives a <a href="POP3.html"><code>POP3</code></a> object to the block and closes the session after block call finishes.</p>

<p>This method raises a <a href="POPAuthenticationError.html"><code>POPAuthenticationError</code></a> if authentication fails.</p>

                              <div class="method-source-code" id="start-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 526</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">start</span>(<span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>) <span class="ruby-comment"># :yield: pop</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&#39;POP session already started&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@started</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">do_start</span> <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>)
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-identifier">do_finish</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">do_start</span> <span class="ruby-identifier">account</span>, <span class="ruby-identifier">password</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-started-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">started?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><code>true</code> if the <a href="POP3.html"><code>POP3</code></a> session has started.</p>

                              <div class="method-source-code" id="started-3F-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 514</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">started?</span>
  <span class="ruby-ivar">@started</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="POP3.html#method-i-active-3F">active?</a>
                            </div>

                          </div>

                  <div id="method-i-use_ssl-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">use_ssl?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>does this instance use SSL?</p>

                              <div class="method-source-code" id="use_ssl-3F-source">
            <pre><span class="ruby-comment"># File net-pop-0.1.2/lib/net/pop.rb, line 441</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">use_ssl?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@ssl_params</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

